//
//  HPCollectionViewCell.m
//  彩虹儿歌
//
//  Created by HelloWorld_L on 15/6/30.
//  Copyright (c) 2015年 HelloBaby. All rights reserved.
//

#import "HPCollectionViewCell.h"
#import "MacroHeader.h"
#import <UIImageView+WebCache.h>

@implementation HPCollectionViewCell

- (void)dealloc
{
    [_coverImgV release];
    [_titleLab release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.coverImgV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, (SCREEN_WIDTH - 30) / 2, (SCREEN_WIDTH - 30) / 2)];
    
        
        self.titleLab = [[UILabel alloc] initWithFrame:CGRectMake(0, (SCREEN_WIDTH - 30) / 2 - 30, (SCREEN_WIDTH - 30) / 2, 30)];
        self.titleLab.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
        self.titleLab.textColor = [UIColor whiteColor];
        self.titleLab.textAlignment = NSTextAlignmentCenter;

        
        [self.coverImgV addSubview:self.titleLab];
        [self.contentView addSubview:self.coverImgV];
        [self.titleLab release];
        [self.coverImgV release];
    }
    return self;
}

- (void)setModel:(HPVCModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [self.coverImgV sd_setImageWithURL:[NSURL URLWithString:model.recommend_pic]];
    
    self.titleLab.text = model.recommend_title;
}

@end
